package com.ruoyi.project.mobile;

import com.ruoyi.common.utils.R;
import com.ruoyi.common.utils.RFactory;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.project.system.activity.domain.Activity;
import com.ruoyi.project.system.activity.service.IActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 案例区接口
 *
 * @autor LCL
 * @date - 2020/11/18
 */
@RestController
@RequestMapping("/api/case")
public class ApiCaseareaController extends BaseController {

    @Autowired
    private IActivityService activityService;

    /**
     * 查询案例列表
     * @param uid
     * @return
     */
    @GetMapping("/caseList")
    public R caseList(@RequestParam String uid) {
        startPage();
        Activity activity = new Activity();
        activity.setIsShow(1);
        return RFactory.generateR(getDataTable(this.activityService.selectActivityList(activity)));
    }

    /**
     * 根据ID查询案例
     * @param id 案例ID
     * @return
     */
    @GetMapping("/detailsById")
    public R detailsById(@RequestParam String id) {
        return RFactory.generateR(this.activityService.selectActivityById(id));
    }

}
